<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#" xml:lang="th" lang="th">
<head>
	<meta charset="utf-8">
    <title>Module Video Player</title>	
    <!--Load Js-->
    <?php 
    if(!empty($js)):
  		foreach($js as $value):
   			if(file_exists(realpath(@$this->config->item('path_asset_url').'assets/js/'.$value)) && !empty($value)):
   				echo js_asset($value)."\n";				
     		endif;
		endforeach;
    endif;
    ?>
</head>
<body>
<div id="module_video_player">
	<!--Vdo Player-->
	<div id="moduleVdoPlayer">
		<?php if($this->agent->is_mobile()):?>
			<video id='module_my_video' controls muted preload='none'></video>
		<?php endif;?>
	</div>
	<script type="text/javascript" language="javascript">
	(function($) {
	/*whatever jQuery stuff*/
		$(function(){
			var is_mobile = '';
			var url_arr = new Array;
			url_arr[1] = 'http://static.you2play.com/2013/assets/uploads/video/files/2013/09/03/7c972dbbf0aa5e5da83bc2f79c380e37.mp4';
			url_arr[2] = 'http://static.you2play.com/2013/assets/uploads/video/files/2013/08/29/6e2fa050379a3b0a39d23058eccabf28.mp4';
			var url = url_arr[Math.floor(Math.random()*2)+1];
			if(is_mobile){
				//Set Video Source
				$('#module_my_video').append("<source id='mp4' src='"+url+"' type='video/mp4'>");
				$('#module_my_video').attr('src',""+url+"");
				$('#module_my_video').attr('width',300);
				$('#module_my_video').attr('height',170);		
				// videoplaza sdk, 4 sec time-out, callback function
				loadScript("http://static.you2play.com/2013/assets/js/media/html5-sdk-1.0.12.15.1-ea.min.js",4000,initVideoplaza);
				// *** START - videoplaza plugin config ***
				vpConfig = {
					vphost : 'http://th-pmdplus.videoplaza.tv',
					category : 'video',
					tags : ['standard'],
					flags: [],
					playbackPosition: [] // mid-roll cue points, if any.
				}
				// *** END - videoplaza plugin config ***
				//Auto Play && Loop
				$('#module_my_video').attr('autoplay','autoplay');	
			} else {
				jwplayer("moduleVdoPlayer").setup({
					autostart: true,
					mute: true,
			      	flashplayer: "http://static.you2play.com/2013/assets/js/media/player.swf",
			      	width: 300,
			      	height: 170,
					file: ""+url+"",
			      	plugins: "http://static.you2play.com/2013/assets/js/media/vp_plugin.swf",
			      	vpdomain: "http://th-pmdplus.videoplaza.tv",
			      	vpshares: "video",
			      	vptags: "",
	               	//provider: "http",
	        		//startparam: "starttime",
					vptimeout: 15000,
					closebuttontimeout: 5			
				});		
			}	
		});	
	})(jQuery);
	</script>
</div>
</body>
</html>